<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>CMS</title>
<link href="__CSS__/common.css" rel="stylesheet"/>
<link href="__CSS__/right.css" rel="stylesheet"/>
<link rel="stylesheet" href="__INC__/form/css/zebra_form.css" type="text/css">
<script type="text/javascript" language="javascript" src="__JS__/jquery-1.7.2.min.js"></script>
<script type="text/javascript" language="javascript" src="__JS__/FusionCharts.js"></script>
<script type="text/javascript" language="javascript" src="__JS__/common.js"></script>
<script type="text/javascript" language="javascript">
    $(document).ready(function () {
        $(".table_list tr").mouseover(function () {
            $(this).addClass("one");
        })
        $(".table_list tr").mouseout(function () {
            $(this).removeClass("one");
        })
    });
</script>
<style type="text/css">
    .one {
        background: #fcfcfc;
    }
</style>
<style type="text/css">
    #panel {
        width: 100%;
    }
    .infos_left {
        float: left;
        width: 700px;
    }
    .infos_right {
        width: 150px;
        float: right;
        margin-right: 150px;
    }
    .category td {
        border-bottom: 1px dotted #CCC;
        border-width: 1px 0;
    }
</style>
</head>
<body>
<!--右侧区域 begin-->
<div class="right">
    <!--当前位置 begin-->
    <include file='common:crumbs'/>
    <!--当前位置 end-->
    <!--主体区域 begin-->
    <div class="container">
        <div class="alert_div">
            <h4 class="alert_info"><span class="welcome">{$welcome}</span>您现在的位置是：{$current} </h4>
            <h4 class="alert_what" style="display:none;"></h4>
        </div>
        <!--样式二 begin-->
        <div class="stats">
            <div class="lm_title">
                <div class="lm_title_l">
                    <em><img src="__IMG__/add_btn.jpg" style="float:right;margin-right:30px;" onclick="openpanel('add','-1');"/>{$current}</em>
                </div>
            </div>
            <div class="lm_table">
                <table cellpadding="0" cellspacing="0" width="100%" class="table_list">
                    <tr class="title" align="center">
                        <td>&nbsp;</td>
                        <td align="left" style="text-align:left;">种类名称</td>
                        <td>属性数量</td>
                        <td>状态</td>
                        <td>操作</td>
                    </tr>
                    <volist name='list' id='arr'>
                        <!--tr class="tr_line">
                            <td colspan="10"><div></div></td>
                        </tr-->
                        <tr align="left" class="category">
                            <td>&nbsp;&nbsp;&nbsp;</td>
                            <td align="left"><img src="__IMG__/none.png" width="12" style="margin-right:10px;"></img>&nbsp;{$arr['name']}
                            </td>
                            <td>{:goodstypeAttrCount($arr['id'])}</td>
                            <td>{:status($arr['status'])}</td>
                            <td width="140px">
                                <a href="__GROUP__/attribute/show?gtid={$arr['id']}">属性列表</a> |
                                <a href="javascript:void(0)" onclick="openpanel('edit',{$arr['id']},'{$arr['name']}')">修改</a> |
                                <a href="javascript:void(0)" onclick="openpanel('del','{$arr['id']}')">删除</a></td>
                        </tr>
                    </volist>
                </table>
            </div>
            <div class="lm_table_bottom">
                <div class="lm_table_bottom_l">
                    <em>
                        <div class="page">{$page}</div>
                        <div class="clear"></div>
                    </em>
                </div>
            </div>
        </div>
        <!--样式二 end-->
    </div>
    <!--主体区域 end-->
</div>
<!--右侧区域  end-->
<!--弹出层二begin-->
<div class="popupPanel">
    <div class="stats">
        <div class="lm_title">
            <div class="lm_title_l"><em class="panelTitle">做什么？</em></div>
        </div>
        <div class="lm_content">
            <table class="Zebra_Form" style="width:100%;">
                <tr class="row panel_1">
                    <td width="60"><label>已选ID：</label></td>
                    <input type="hidden" class="controlitems" value=""></input>
                    <input type="hidden" class="panelaction" value=""></input>
                    <td colspan="2" class="checked_items"><label style="color:#FF00AE;"></label></td>
                </tr>
                <tr class="row panel_2">
                    <td width="80"><label>商品种类：</label></td>
                    <input type="hidden" class="panelaction" value=""></input>
                    <td colspan="2"><input type="text" class="text" id="goodstype_name" value=""></input></td>
                </tr>
                <tr class="row">
                    <td></td>
                    <td><input type="button" onclick="panelDo()" class="button" value="确定"/></td>
                    <td><input type="button" class="button" onclick="panelClose()" value="取消"/></td>
                </tr>
            </table>
        </div>
        <div class="lm_bottom">
            <div class="lm_bottom_l"><em></em></div>
        </div>
    </div>
</div>
<!--弹出层二end-->
</body>
<script>
    //开启panel窗口
    function openpanel(act, item, name) {
        //初始化关闭所有附加panel
        if (item === undefined || typeof(item) == 'undefined') {
            item = getSelects();
        }
        if (item == '') {
            jl_notify(3, "你没有选中任何项！");
            return;
        }
        $(".controlitems").val(item);
        $('.checked_items label').text(item);
        if (act == 'del') {
            $(".panelTitle").text("你确定要删除该商品种类？");
            $(".panelaction").val("del");
            $(".panel_2").hide();
            $(".panel_1").show();
            var obj = $('.popupPanel');
            jl_fadeIn(obj);
        } else if (act == 'add') {
            $(".panelTitle").text("请输入新商品种类名称!");
            $(".panelaction").val("add");
            $("#goodstype_name").val('');
            $(".panel_1").hide();
            $(".panel_2").show();
            var obj = $('.popupPanel');
            jl_fadeIn(obj);
        } else if (act == 'edit') {
            $(".panelTitle").text("请修改种商品类名称!");
            $(".panelaction").val("edit");
            $("#goodstype_name").val(name);
            $(".panel_1").hide();
            $(".panel_2").show();
            var obj = $('.popupPanel');
            jl_fadeIn(obj);
        } else {
            jl_notify(3, "不知道你到底要干什么！");
            return;
        }
    }

    //关闭panel窗口
    function panelClose() {
        var obj = $('.popupPanel');
        jl_fadeOut(obj);
    }

    //panel执行操作
    function panelDo() {
        var act = $(".panelaction").val();
        if (act == '') {
            jl_notify(3, "不知道你到底要干什么！");
            return;
        }
        if (act == 'del') {
            jl_fadeOut($('.popupPanel'));
            var items = $(".controlitems").val();
            $.post("__GROUP__/shopajax/delgoodstype", {
                items: items
            }, function (data) {
                if (data == -1) {
                    jl_notify(2, "呜呜，删除这些商品种类失败！");
                } else if (data == -3) {
                    jl_notify(3, "请先删除该商品种类下的属性！");
                } else if (data == 1) {
                    //jl_notify(1,"嘻嘻，删除栏目成功！");
                    location.href = location.href;
                } else {
                    jl_notify(2, "呜呜，种种原因导致删除这些商品种类失败！");
                }
            });
        } else if (act == 'add') {
            jl_fadeOut($('.popupPanel'));
            var items = $.trim($("#goodstype_name").val());
            if (items == '') {
                jl_notify(3, "商品种类名不能为空！");
            }
            $.post("__GROUP__/shopajax/addgoodstype", {
                items: items
            }, function (data) {
                if (data == -1) {
                    jl_notify(2, "呜呜，添加商品种类失败！");
                } else if (data == -3) {
                    jl_notify(3, "该商品种类已经存在！");
                } else if (data == 1) {
                    //jl_notify(1,"嘻嘻，删除栏目成功！");
                    location.href = location.href;
                } else {
                    jl_notify(2, "呜呜，添加商品种类失败！");
                }
            });
        } else if (act == 'edit') {
            jl_fadeOut($('.popupPanel'));
            var items = $(".controlitems").val();
            var name = $.trim($("#goodstype_name").val());
            if (items == '') {
                jl_notify(3, "种类型不能为空！");
            }
            $.post("__GROUP__/shopajax/editgoodstype", {
                items: items,
                name: name
            }, function (data) {
                if (data == -1) {
                    jl_notify(2, "呜呜，修改种类失败！");
                } else if (data == -3) {
                    jl_notify(3, "该种类已经存在！");
                } else if (data == 1) {
                    location.href = location.href;
                } else {
                    jl_notify(2, "呜呜，修改种类失败！");
                }
            });
        } else {
            jl_notify(3, "不知道你到底要干什么！");
            return;
        }
    }
</script>
</html>